public class Ticket {
    private double price;
    private IDiscount discount;

    public void setPrice(double price) {
        this.price = price;
    }

    public void setDiscount(IDiscount discount) {
        this.discount = discount;
    }

    public String getPrice() {
        //调用折扣类的折扣价计算方法
        return discount.calculate(this.price);
    }

}
